package name.vaccari.matteo.tai.phonedirectory.network;

import java.util.Map;

public class MockServlet implements Servlet {

	private final String body;
	private String lastPath;
	private Map<String, String> params;
	private String lastMethodCalled;

	public MockServlet(String body) {
		this.body = body;
	}

	public String doGet(String path) {
		lastMethodCalled = "doGet";
		this.lastPath = path;
		return body;
	}

	public String getLastPath() {
		return lastPath;
	}

	public String doPost(String path, Map<String, String> params) {
		lastMethodCalled = "doPost";
		this.params = params;
		return "";
	}

	public String getParam(String string) {
		return params .get(string);
	}

	public String getLastMethodCalled() {
		return this.lastMethodCalled;
	}

}
